﻿using System;
using System.Collections.Generic;
using System.Text;

namespace Ex03.VehicalsObjectModel
{
    internal class FuleEnergySystem : VehicalEnergySystem
    {
        // Members
        private eFuleType m_FuleType;

        /// <summary>
        /// Creates a new FuleEnergySystem object
        /// </summary>
        /// <param name="i_FuleType">The fule type of the system</param>
        /// <param name="i_MaxFuleAmount">The maximum fule amount available by the system</param>
        /// <exception cref="ArgumentException">On negtaive fule amount</exception>
        public FuleEnergySystem(eFuleType i_FuleType, float i_MaxFuleAmount) : base(i_MaxFuleAmount)
        {
            m_FuleType = i_FuleType;
        }

        /// <summary>
        /// Gets the current amount of fule in the system
        /// </summary>
        public float CurrentFuleAmount
        {
            get 
            { 
                return m_CurrentAmount; 
            }
        }

        /// <summary>
        /// Gets the mximum amount of fule the system can hold
        /// </summary>
        public float MaxFuleAmount
        {
            get 
            { 
                return m_MaxAmount; 
            }
        }

        /// <summary>
        /// Gets the system fule type
        /// </summary>
        public eFuleType FuleType
        {
            get 
            { 
                return m_FuleType; 
            }
        }

        /// <summary>
        /// Fules the system with a given amount of a certain fule type
        /// </summary>
        /// <param name="i_FuleType">The type of fule</param>
        /// <param name="i_AddedFuleAmount">The amount of fule to add</param>
        /// <exception cref="ArgumentException">When the fule type doesnt match the system's</exception>
        /// <exception cref="ValueOutOfRangeException">When the fule amount is negative or exceeds the capacity of the system</exception>
        public void Fule(eFuleType i_FuleType, float i_AddedFuleAmount)
        {
            // Check if the fule type matches the system
            // And if the amount isnt negative and doesnt exceed the capacity
            if (i_FuleType != FuleType)
            {
                throw new ArgumentException("Given fule type doesnt match the systems fule type");
            }
            else
            {
                // Add the fule to the system
                AddEnergy(i_AddedFuleAmount);
            }
        }
    }
}
